package com.bst.bsj.common.dal.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.bst.bsj.common.dal.daointerface.SeedlingModelParamsDAO;
import com.bst.bsj.common.dal.dataobject.SeedlingModelParams;
import com.sylinxsoft.tools.dao.impl.CommonBaseDAOImpl;

@Service("seedlingModelParamsDAO")
public class SeedlingModelParamsDAOImpl extends CommonBaseDAOImpl implements SeedlingModelParamsDAO {

  @Override
  public Long getCounts(Map paramMap) {
    return (Long) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_QUERY_COUNT", paramMap);
  }

  @Override
  public List<SeedlingModelParams> selectAll(Map paramMap, Long offset, Long length) {
    paramMap.put("offset", offset);
    paramMap.put("length", length);
    return (List<SeedlingModelParams>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_QUERY_PAGE",
        paramMap);
  }

  @Override
  public SeedlingModelParams getSeedlingModelParams(Long id) {
    return (SeedlingModelParams) getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_SELECT", id);
  }

  @Override
  public int update(SeedlingModelParams seedlingModelParams) {
    return getSqlMapClientTemplate().update(getNameSpace() + ".MS_UPDATE", seedlingModelParams);
  }

  @Override
  public Long insert(SeedlingModelParams seedlingModelParams) {
    return (Long) getSqlMapClientTemplate().insert(getNameSpace() + ".MS_INSERT", seedlingModelParams);
  }

  @Override
  public int delete(Long id) {
    return getSqlMapClientTemplate().delete(getNameSpace() + ".MS_DELETE", id);
  }

  @Override
  public List<SeedlingModelParams> selectNamesAll(String ids) {
    return (List<SeedlingModelParams>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_SELECTALL",
        ids);
  }

  @Override
  public List<SeedlingModelParams> getAll() {
    return (List<SeedlingModelParams>) this.getSqlMapClientTemplate().queryForList(getNameSpace() + ".MS_GETALL");
  }

  @Override
  public SeedlingModelParams getExsit(String name) {
    return  (SeedlingModelParams) this.getSqlMapClientTemplate().queryForObject(getNameSpace() + ".MS_EXIST",name);
  }

}
